﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Model;
using Utility;
namespace Service
{
    /// <summary>
    /// 功能：Report_TB_Grade类数据访问
    /// 创建人：Wilson
    /// 创建时间：2013-1-30   
    /// </summary>
    public class Report_TB_GradeService : IDisposable
    {
        #region 公共
        private System.ComponentModel.Component component = new System.ComponentModel.Component();

        private bool disposed = false;

        ~Report_TB_GradeService()
        {
            Dispose(false);
        }

        #endregion
        
        #region IDisposable 成员

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!this.disposed)
            {

                if (disposing)
                {

                    component.Dispose();
                }

                disposed = true;

            }
        }
        #endregion
        #region##MapperReport_TB_Grade
        public IList<Report_TB_Grade> MapperList(SqlDataReader reader)
        {
            IList<Report_TB_Grade> list = new List<Report_TB_Grade>();
            Report_TB_Grade obj = null;
            while (reader.Read())
            {
                obj = new Report_TB_Grade();
                obj.GuId4 = (decimal)reader["GuId4"];
                obj.RID = (string)reader["RID"];
                obj.TJND5 = (string)reader["TJND5"];
                obj.GRADEBH3 = (string)reader["GRADEBH3"];
                obj.XB = (string)reader["XB"];
                obj.CityId = (string)reader["CityId"];
                obj.DISTRICTID = (string)reader["DISTRICTID"];
                obj.SCHOOLBH = (string)reader["SCHOOLBH"];
                obj.SchoolType = reader["SchoolType"] as string;
                obj.XS = reader["XS"] as int?;
                obj.SJ = reader["SJ"] as int?;
                obj.H1 = reader["H1"] as int?;
                obj.H1B = reader["H1B"] as decimal?;
                obj.H2 = reader["H2"] as int?;
                obj.H2B = reader["H2B"] as decimal?;
                obj.H3 = reader["H3"] as int?;
                obj.H3B = reader["H3B"] as decimal?;
                obj.H4 = reader["H4"] as int?;
                obj.H4B = reader["H4B"] as decimal?;
                obj.H5 = reader["H5"] as int?;
                obj.H5B = reader["H5B"] as decimal?;
                obj.H6 = reader["H6"] as int?;
                obj.H6B = reader["H6B"] as decimal?;
                obj.H7 = reader["H7"] as int?;
                obj.H7B = reader["H7B"] as decimal?;
                obj.H8 = reader["H8"] as int?;
                obj.H8B = reader["H8B"] as decimal?;
                obj.H9 = reader["H9"] as int?;
                obj.H9B = reader["H9B"] as decimal?;
                obj.H10 = reader["H10"] as int?;
                obj.H10B = reader["H10B"] as decimal?;
                obj.H11 = reader["H11"] as int?;
                obj.H11B = reader["H11B"] as decimal?;
                obj.H12 = reader["H12"] as int?;
                obj.H12B = reader["H12B"] as decimal?;
                obj.H13 = reader["H13"] as int?;
                obj.H13B = reader["H13B"] as decimal?;
                obj.H14 = reader["H14"] as int?;
                obj.H14B = reader["H14B"] as decimal?;
                obj.H15 = reader["H15"] as int?;
                obj.H15B = reader["H15B"] as decimal?;
                obj.H16 = reader["H16"] as int?;
                obj.H16B = reader["H16B"] as decimal?;
                obj.H17 = reader["H17"] as int?;
                obj.H17B = reader["H17B"] as decimal?;
                obj.H18 = reader["H18"] as int?;
                obj.H18B = reader["H18B"] as decimal?;
                obj.H19 = reader["H19"] as int?;
                obj.H19B = reader["H19B"] as decimal?;
                obj.H20 = reader["H20"] as int?;
                obj.H20B = reader["H20B"] as decimal?;
                list.Add(obj);
            }
            return list;
        }
        public Report_TB_Grade Mapper(SqlDataReader reader)
        {
            Report_TB_Grade obj = null;
            if (reader.Read())
            {
                obj = new Report_TB_Grade();
                obj.GuId4 = (decimal)reader["GuId4"];
                obj.RID = (string)reader["RID"];
                obj.TJND5 = (string)reader["TJND5"];
                obj.GRADEBH3 = (string)reader["GRADEBH3"];
                obj.XB = (string)reader["XB"];
                obj.CityId = (string)reader["CityId"];
                obj.DISTRICTID = (string)reader["DISTRICTID"];
                obj.SCHOOLBH = (string)reader["SCHOOLBH"];
                obj.SchoolType = reader["SchoolType"] as string;
                obj.XS = reader["XS"] as int?;
                obj.SJ = reader["SJ"] as int?;
                obj.H1 = reader["H1"] as int?;
                obj.H1B = reader["H1B"] as decimal?;
                obj.H2 = reader["H2"] as int?;
                obj.H2B = reader["H2B"] as decimal?;
                obj.H3 = reader["H3"] as int?;
                obj.H3B = reader["H3B"] as decimal?;
                obj.H4 = reader["H4"] as int?;
                obj.H4B = reader["H4B"] as decimal?;
                obj.H5 = reader["H5"] as int?;
                obj.H5B = reader["H5B"] as decimal?;
                obj.H6 = reader["H6"] as int?;
                obj.H6B = reader["H6B"] as decimal?;
                obj.H7 = reader["H7"] as int?;
                obj.H7B = reader["H7B"] as decimal?;
                obj.H8 = reader["H8"] as int?;
                obj.H8B = reader["H8B"] as decimal?;
                obj.H9 = reader["H9"] as int?;
                obj.H9B = reader["H9B"] as decimal?;
                obj.H10 = reader["H10"] as int?;
                obj.H10B = reader["H10B"] as decimal?;
                obj.H11 = reader["H11"] as int?;
                obj.H11B = reader["H11B"] as decimal?;
                obj.H12 = reader["H12"] as int?;
                obj.H12B = reader["H12B"] as decimal?;
                obj.H13 = reader["H13"] as int?;
                obj.H13B = reader["H13B"] as decimal?;
                obj.H14 = reader["H14"] as int?;
                obj.H14B = reader["H14B"] as decimal?;
                obj.H15 = reader["H15"] as int?;
                obj.H15B = reader["H15B"] as decimal?;
                obj.H16 = reader["H16"] as int?;
                obj.H16B = reader["H16B"] as decimal?;
                obj.H17 = reader["H17"] as int?;
                obj.H17B = reader["H17B"] as decimal?;
                obj.H18 = reader["H18"] as int?;
                obj.H18B = reader["H18B"] as decimal?;
                obj.H19 = reader["H19"] as int?;
                obj.H19B = reader["H19B"] as decimal?;
                obj.H20 = reader["H20"] as int?;
                obj.H20B = reader["H20B"] as decimal?;
            }
            return obj;
        }
        #endregion
        #region##通过主键ID得到Report_TB_Grade
        /// <summary>
        /// 功能：通过ID得到Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30   
        /// </summary>
        /// <param name="">主键ID</param>
        /// <returns></returns>
        public Report_TB_Grade GetById(decimal guid4)
        {
            string sql = "select * from Report_TB_Grade where GuId4 = @PK";
            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@PK",9)
            };

            SqlDataReader reader = SqlHelper.ExecuteReader(WebConn.connString, CommandType.Text, sql, sp);
            return Mapper(reader);
        }
        #endregion

        #region##通过主键ID删除Report_TB_Grade
        /// <summary>
        /// 功能：通过主键ID删除Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30   
        /// </summary>
        /// <param name="">主键ID</param>
        /// <returns></returns>
        public int DeleteById(decimal guid4)
        {
            int i = 0;
            string sql = "delete from Report_TB_Grade where GuId4 = @PK";
            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@PK",9)
            };
            i = SqlHelper.ExecuteNonQuery(WebConn.connString, CommandType.Text, sql, sp);
            return i;
        }
        /// <summary>
        /// 功能：通过主键ID删除Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30   
        /// </summary>
        /// <param name="">主键ID</param>
        /// <returns></returns>
        public int DeleteById(SqlTransaction transaction, decimal guid4)
        {
            int i = 0;
            string sql = "delete from Report_TB_Grade where GuId4 = @PK";
            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@PK",9)
            };
            i = SqlHelper.ExecuteNonQuery(transaction, CommandType.Text, sql, sp);
            return i;
        }
        #endregion

        #region##添加Report_TB_Grade
        /// <summary>
        /// 功能：添加Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int Add(Report_TB_Grade report_tb_grade)
        {
            int result = 0;
            string sql = "insert into Report_TB_Grade(GuId4,RID,TJND5,Grade3,XB,CityId,DISTRICTID,SCHOOLBH,SchoolType,XS,SJ,H1,H1B,H2,H2B,H3,H3B,H4,H4B,H5,H5B,H6,H6B,H7,H7B,H8,H8B,H9,H9B,H10,H10B,H11,H11B,H12,H12B,H13,H13B,H14,H14B,H15,H15B,H16,H16B,H17,H17B,H18,H18B,H19,H19B,H20,H20B) values(@GuId4,@RID,@TJND5,@Grade3,@XB,@CityId,@DISTRICTID,@SCHOOLBH,@SchoolType,@XS,@SJ,@H1,@H1B,@H2,@H2B,@H3,@H3B,@H4,@H4B,@H5,@H5B,@H6,@H6B,@H7,@H7B,@H8,@H8B,@H9,@H9B,@H10,@H10B,@H11,@H11B,@H12,@H12B,@H13,@H13B,@H14,@H14B,@H15,@H15B,@H16,@H16B,@H17,@H17B,@H18,@H18B,@H19,@H19B,@H20,@H20B)";
            SqlParameter[] sp = new SqlParameter[]
            {
				new SqlParameter("@GuId4",report_tb_grade.GuId4),
				new SqlParameter("@RID",report_tb_grade.RID),
				new SqlParameter("@TJND5",report_tb_grade.TJND5),
				new SqlParameter("@GRADEBH3",report_tb_grade.GRADEBH3),
				new SqlParameter("@XB",report_tb_grade.XB),
				new SqlParameter("@CityId",report_tb_grade.CityId),
				new SqlParameter("@DISTRICTID",report_tb_grade.DISTRICTID),
				new SqlParameter("@SCHOOLBH",report_tb_grade.SCHOOLBH),
				new SqlParameter("@SchoolType",report_tb_grade.SchoolType),
				new SqlParameter("@XS",report_tb_grade.XS),
				new SqlParameter("@SJ",report_tb_grade.SJ),
				new SqlParameter("@H1",report_tb_grade.H1),
				new SqlParameter("@H1B",report_tb_grade.H1B),
				new SqlParameter("@H2",report_tb_grade.H2),
				new SqlParameter("@H2B",report_tb_grade.H2B),
				new SqlParameter("@H3",report_tb_grade.H3),
				new SqlParameter("@H3B",report_tb_grade.H3B),
				new SqlParameter("@H4",report_tb_grade.H4),
				new SqlParameter("@H4B",report_tb_grade.H4B),
				new SqlParameter("@H5",report_tb_grade.H5),
				new SqlParameter("@H5B",report_tb_grade.H5B),
				new SqlParameter("@H6",report_tb_grade.H6),
				new SqlParameter("@H6B",report_tb_grade.H6B),
				new SqlParameter("@H7",report_tb_grade.H7),
				new SqlParameter("@H7B",report_tb_grade.H7B),
				new SqlParameter("@H8",report_tb_grade.H8),
				new SqlParameter("@H8B",report_tb_grade.H8B),
				new SqlParameter("@H9",report_tb_grade.H9),
				new SqlParameter("@H9B",report_tb_grade.H9B),
				new SqlParameter("@H10",report_tb_grade.H10),
				new SqlParameter("@H10B",report_tb_grade.H10B),
				new SqlParameter("@H11",report_tb_grade.H11),
				new SqlParameter("@H11B",report_tb_grade.H11B),
				new SqlParameter("@H12",report_tb_grade.H12),
				new SqlParameter("@H12B",report_tb_grade.H12B),
				new SqlParameter("@H13",report_tb_grade.H13),
				new SqlParameter("@H13B",report_tb_grade.H13B),
				new SqlParameter("@H14",report_tb_grade.H14),
				new SqlParameter("@H14B",report_tb_grade.H14B),
				new SqlParameter("@H15",report_tb_grade.H15),
				new SqlParameter("@H15B",report_tb_grade.H15B),
				new SqlParameter("@H16",report_tb_grade.H16),
				new SqlParameter("@H16B",report_tb_grade.H16B),
				new SqlParameter("@H17",report_tb_grade.H17),
				new SqlParameter("@H17B",report_tb_grade.H17B),
				new SqlParameter("@H18",report_tb_grade.H18),
				new SqlParameter("@H18B",report_tb_grade.H18B),
				new SqlParameter("@H19",report_tb_grade.H19),
				new SqlParameter("@H19B",report_tb_grade.H19B),
				new SqlParameter("@H20",report_tb_grade.H20),
				new SqlParameter("@H20B",report_tb_grade.H20B)
            };
            result = SqlHelper.ExecuteNonQuery(WebConn.connString, CommandType.Text, sql, sp);
            return result;
        }
        /// <summary>
        /// 功能：添加Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int Add(SqlTransaction transaction, Report_TB_Grade report_tb_grade)
        {
            int result = 0;
            string sql = "insert into Report_TB_Grade(GuId4,RID,TJND5,Grade3,XB,CityId,DISTRICTID,SCHOOLBH,SchoolType,XS,SJ,H1,H1B,H2,H2B,H3,H3B,H4,H4B,H5,H5B,H6,H6B,H7,H7B,H8,H8B,H9,H9B,H10,H10B,H11,H11B,H12,H12B,H13,H13B,H14,H14B,H15,H15B,H16,H16B,H17,H17B,H18,H18B,H19,H19B,H20,H20B) values(@GuId4,@RID,@TJND5,@Grade3,@XB,@CityId,@DISTRICTID,@SCHOOLBH,@SchoolType,@XS,@SJ,@H1,@H1B,@H2,@H2B,@H3,@H3B,@H4,@H4B,@H5,@H5B,@H6,@H6B,@H7,@H7B,@H8,@H8B,@H9,@H9B,@H10,@H10B,@H11,@H11B,@H12,@H12B,@H13,@H13B,@H14,@H14B,@H15,@H15B,@H16,@H16B,@H17,@H17B,@H18,@H18B,@H19,@H19B,@H20,@H20B)";
            SqlParameter[] sp = new SqlParameter[]
            {
				new SqlParameter("@GuId4",report_tb_grade.GuId4),
				new SqlParameter("@RID",report_tb_grade.RID),
				new SqlParameter("@TJND5",report_tb_grade.TJND5),
				new SqlParameter("@GRADEBH3",report_tb_grade.GRADEBH3),
				new SqlParameter("@XB",report_tb_grade.XB),
				new SqlParameter("@CityId",report_tb_grade.CityId),
				new SqlParameter("@DISTRICTID",report_tb_grade.DISTRICTID),
				new SqlParameter("@SCHOOLBH",report_tb_grade.SCHOOLBH),
				new SqlParameter("@SchoolType",report_tb_grade.SchoolType),
				new SqlParameter("@XS",report_tb_grade.XS),
				new SqlParameter("@SJ",report_tb_grade.SJ),
				new SqlParameter("@H1",report_tb_grade.H1),
				new SqlParameter("@H1B",report_tb_grade.H1B),
				new SqlParameter("@H2",report_tb_grade.H2),
				new SqlParameter("@H2B",report_tb_grade.H2B),
				new SqlParameter("@H3",report_tb_grade.H3),
				new SqlParameter("@H3B",report_tb_grade.H3B),
				new SqlParameter("@H4",report_tb_grade.H4),
				new SqlParameter("@H4B",report_tb_grade.H4B),
				new SqlParameter("@H5",report_tb_grade.H5),
				new SqlParameter("@H5B",report_tb_grade.H5B),
				new SqlParameter("@H6",report_tb_grade.H6),
				new SqlParameter("@H6B",report_tb_grade.H6B),
				new SqlParameter("@H7",report_tb_grade.H7),
				new SqlParameter("@H7B",report_tb_grade.H7B),
				new SqlParameter("@H8",report_tb_grade.H8),
				new SqlParameter("@H8B",report_tb_grade.H8B),
				new SqlParameter("@H9",report_tb_grade.H9),
				new SqlParameter("@H9B",report_tb_grade.H9B),
				new SqlParameter("@H10",report_tb_grade.H10),
				new SqlParameter("@H10B",report_tb_grade.H10B),
				new SqlParameter("@H11",report_tb_grade.H11),
				new SqlParameter("@H11B",report_tb_grade.H11B),
				new SqlParameter("@H12",report_tb_grade.H12),
				new SqlParameter("@H12B",report_tb_grade.H12B),
				new SqlParameter("@H13",report_tb_grade.H13),
				new SqlParameter("@H13B",report_tb_grade.H13B),
				new SqlParameter("@H14",report_tb_grade.H14),
				new SqlParameter("@H14B",report_tb_grade.H14B),
				new SqlParameter("@H15",report_tb_grade.H15),
				new SqlParameter("@H15B",report_tb_grade.H15B),
				new SqlParameter("@H16",report_tb_grade.H16),
				new SqlParameter("@H16B",report_tb_grade.H16B),
				new SqlParameter("@H17",report_tb_grade.H17),
				new SqlParameter("@H17B",report_tb_grade.H17B),
				new SqlParameter("@H18",report_tb_grade.H18),
				new SqlParameter("@H18B",report_tb_grade.H18B),
				new SqlParameter("@H19",report_tb_grade.H19),
				new SqlParameter("@H19B",report_tb_grade.H19B),
				new SqlParameter("@H20",report_tb_grade.H20),
				new SqlParameter("@H20B",report_tb_grade.H20B)
            };
            result = SqlHelper.ExecuteNonQuery(transaction, CommandType.Text, sql, sp);
            return result;
        }
        #endregion

        #region##得到Report_TB_Grade集合
        /// <summary>
        /// 功能：得到Report_TB_Grade集合
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30
        /// </summary>       
        /// <returns></returns>
        public IList<Report_TB_Grade> GetList()
        {
            string sql = "select * from Report_TB_Grade";
            SqlDataReader reader = SqlHelper.ExecuteReader(WebConn.connString, CommandType.Text, sql);
            return MapperList(reader);
        }
        public DataSet GetDataTable()
        {
            string sql = "select * from Report_TB_Grade";
            DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql);
            return ds;
        }
        #endregion

        #region##修改Report_TB_Grade
        /// <summary>
        /// 功能：修改Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int ModReport_TB_Grade(Report_TB_Grade report_tb_grade)
        {
            int result = 0;
            string sql = "update Report_TB_Grade set GuId4 = @GuId4,RID = @RID,TJND5 = @TJND5,Grade3 = @Grade3,XB = @XB,CityId = @CityId,DISTRICTID = @DISTRICTID,SCHOOLBH = @SCHOOLBH,SchoolType = @SchoolType,XS = @XS,SJ = @SJ,H1 = @H1,H1B = @H1B,H2 = @H2,H2B = @H2B,H3 = @H3,H3B = @H3B,H4 = @H4,H4B = @H4B,H5 = @H5,H5B = @H5B,H6 = @H6,H6B = @H6B,H7 = @H7,H7B = @H7B,H8 = @H8,H8B = @H8B,H9 = @H9,H9B = @H9B,H10 = @H10,H10B = @H10B,H11 = @H11,H11B = @H11B,H12 = @H12,H12B = @H12B,H13 = @H13,H13B = @H13B,H14 = @H14,H14B = @H14B,H15 = @H15,H15B = @H15B,H16 = @H16,H16B = @H16B,H17 = @H17,H17B = @H17B,H18 = @H18,H18B = @H18B,H19 = @H19,H19B = @H19B,H20 = @H20,H20B = @H20B where GuId4 = @GuId4";
            SqlParameter[] sp = new SqlParameter[]
            {       
				new SqlParameter("@GuId4",report_tb_grade.GuId4),
				new SqlParameter("@RID",report_tb_grade.RID),
				new SqlParameter("@TJND5",report_tb_grade.TJND5),
				new SqlParameter("@GRADEBH3",report_tb_grade.GRADEBH3),
				new SqlParameter("@XB",report_tb_grade.XB),
				new SqlParameter("@CityId",report_tb_grade.CityId),
				new SqlParameter("@DISTRICTID",report_tb_grade.DISTRICTID),
				new SqlParameter("@SCHOOLBH",report_tb_grade.SCHOOLBH),
				new SqlParameter("@SchoolType",report_tb_grade.SchoolType),
				new SqlParameter("@XS",report_tb_grade.XS),
				new SqlParameter("@SJ",report_tb_grade.SJ),
				new SqlParameter("@H1",report_tb_grade.H1),
				new SqlParameter("@H1B",report_tb_grade.H1B),
				new SqlParameter("@H2",report_tb_grade.H2),
				new SqlParameter("@H2B",report_tb_grade.H2B),
				new SqlParameter("@H3",report_tb_grade.H3),
				new SqlParameter("@H3B",report_tb_grade.H3B),
				new SqlParameter("@H4",report_tb_grade.H4),
				new SqlParameter("@H4B",report_tb_grade.H4B),
				new SqlParameter("@H5",report_tb_grade.H5),
				new SqlParameter("@H5B",report_tb_grade.H5B),
				new SqlParameter("@H6",report_tb_grade.H6),
				new SqlParameter("@H6B",report_tb_grade.H6B),
				new SqlParameter("@H7",report_tb_grade.H7),
				new SqlParameter("@H7B",report_tb_grade.H7B),
				new SqlParameter("@H8",report_tb_grade.H8),
				new SqlParameter("@H8B",report_tb_grade.H8B),
				new SqlParameter("@H9",report_tb_grade.H9),
				new SqlParameter("@H9B",report_tb_grade.H9B),
				new SqlParameter("@H10",report_tb_grade.H10),
				new SqlParameter("@H10B",report_tb_grade.H10B),
				new SqlParameter("@H11",report_tb_grade.H11),
				new SqlParameter("@H11B",report_tb_grade.H11B),
				new SqlParameter("@H12",report_tb_grade.H12),
				new SqlParameter("@H12B",report_tb_grade.H12B),
				new SqlParameter("@H13",report_tb_grade.H13),
				new SqlParameter("@H13B",report_tb_grade.H13B),
				new SqlParameter("@H14",report_tb_grade.H14),
				new SqlParameter("@H14B",report_tb_grade.H14B),
				new SqlParameter("@H15",report_tb_grade.H15),
				new SqlParameter("@H15B",report_tb_grade.H15B),
				new SqlParameter("@H16",report_tb_grade.H16),
				new SqlParameter("@H16B",report_tb_grade.H16B),
				new SqlParameter("@H17",report_tb_grade.H17),
				new SqlParameter("@H17B",report_tb_grade.H17B),
				new SqlParameter("@H18",report_tb_grade.H18),
				new SqlParameter("@H18B",report_tb_grade.H18B),
				new SqlParameter("@H19",report_tb_grade.H19),
				new SqlParameter("@H19B",report_tb_grade.H19B),
				new SqlParameter("@H20",report_tb_grade.H20),
				new SqlParameter("@H20B",report_tb_grade.H20B)
            };
            result = SqlHelper.ExecuteNonQuery(WebConn.connString, CommandType.Text, sql, sp);
            return result;
        }
        /// <summary>
        /// 功能：修改Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int ModReport_TB_Grade(SqlTransaction transaction, Report_TB_Grade report_tb_grade)
        {
            int result = 0;
            string sql = "update Report_TB_Grade set GuId4 = @GuId4,RID = @RID,TJND5 = @TJND5,Grade3 = @Grade3,XB = @XB,CityId = @CityId,DISTRICTID = @DISTRICTID,SCHOOLBH = @SCHOOLBH,SchoolType = @SchoolType,XS = @XS,SJ = @SJ,H1 = @H1,H1B = @H1B,H2 = @H2,H2B = @H2B,H3 = @H3,H3B = @H3B,H4 = @H4,H4B = @H4B,H5 = @H5,H5B = @H5B,H6 = @H6,H6B = @H6B,H7 = @H7,H7B = @H7B,H8 = @H8,H8B = @H8B,H9 = @H9,H9B = @H9B,H10 = @H10,H10B = @H10B,H11 = @H11,H11B = @H11B,H12 = @H12,H12B = @H12B,H13 = @H13,H13B = @H13B,H14 = @H14,H14B = @H14B,H15 = @H15,H15B = @H15B,H16 = @H16,H16B = @H16B,H17 = @H17,H17B = @H17B,H18 = @H18,H18B = @H18B,H19 = @H19,H19B = @H19B,H20 = @H20,H20B = @H20B where GuId4 = @GuId4";
            SqlParameter[] sp = new SqlParameter[]
            {       
				new SqlParameter("@GuId4",report_tb_grade.GuId4),
				new SqlParameter("@RID",report_tb_grade.RID),
				new SqlParameter("@TJND5",report_tb_grade.TJND5),
				new SqlParameter("@GRADEBH3",report_tb_grade.GRADEBH3),
				new SqlParameter("@XB",report_tb_grade.XB),
				new SqlParameter("@CityId",report_tb_grade.CityId),
				new SqlParameter("@DISTRICTID",report_tb_grade.DISTRICTID),
				new SqlParameter("@SCHOOLBH",report_tb_grade.SCHOOLBH),
				new SqlParameter("@SchoolType",report_tb_grade.SchoolType),
				new SqlParameter("@XS",report_tb_grade.XS),
				new SqlParameter("@SJ",report_tb_grade.SJ),
				new SqlParameter("@H1",report_tb_grade.H1),
				new SqlParameter("@H1B",report_tb_grade.H1B),
				new SqlParameter("@H2",report_tb_grade.H2),
				new SqlParameter("@H2B",report_tb_grade.H2B),
				new SqlParameter("@H3",report_tb_grade.H3),
				new SqlParameter("@H3B",report_tb_grade.H3B),
				new SqlParameter("@H4",report_tb_grade.H4),
				new SqlParameter("@H4B",report_tb_grade.H4B),
				new SqlParameter("@H5",report_tb_grade.H5),
				new SqlParameter("@H5B",report_tb_grade.H5B),
				new SqlParameter("@H6",report_tb_grade.H6),
				new SqlParameter("@H6B",report_tb_grade.H6B),
				new SqlParameter("@H7",report_tb_grade.H7),
				new SqlParameter("@H7B",report_tb_grade.H7B),
				new SqlParameter("@H8",report_tb_grade.H8),
				new SqlParameter("@H8B",report_tb_grade.H8B),
				new SqlParameter("@H9",report_tb_grade.H9),
				new SqlParameter("@H9B",report_tb_grade.H9B),
				new SqlParameter("@H10",report_tb_grade.H10),
				new SqlParameter("@H10B",report_tb_grade.H10B),
				new SqlParameter("@H11",report_tb_grade.H11),
				new SqlParameter("@H11B",report_tb_grade.H11B),
				new SqlParameter("@H12",report_tb_grade.H12),
				new SqlParameter("@H12B",report_tb_grade.H12B),
				new SqlParameter("@H13",report_tb_grade.H13),
				new SqlParameter("@H13B",report_tb_grade.H13B),
				new SqlParameter("@H14",report_tb_grade.H14),
				new SqlParameter("@H14B",report_tb_grade.H14B),
				new SqlParameter("@H15",report_tb_grade.H15),
				new SqlParameter("@H15B",report_tb_grade.H15B),
				new SqlParameter("@H16",report_tb_grade.H16),
				new SqlParameter("@H16B",report_tb_grade.H16B),
				new SqlParameter("@H17",report_tb_grade.H17),
				new SqlParameter("@H17B",report_tb_grade.H17B),
				new SqlParameter("@H18",report_tb_grade.H18),
				new SqlParameter("@H18B",report_tb_grade.H18B),
				new SqlParameter("@H19",report_tb_grade.H19),
				new SqlParameter("@H19B",report_tb_grade.H19B),
				new SqlParameter("@H20",report_tb_grade.H20),
				new SqlParameter("@H20B",report_tb_grade.H20B)
            };
            result = SqlHelper.ExecuteNonQuery(transaction, CommandType.Text, sql, sp);
            return result;
        }
        #endregion

        #region##统计Report_TB_Grade
        /// <summary>
        /// 修改Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int SelectCount()
        {
            int i = 0;
            string sql = "select count(*) from Report_TB_Grade";
            i = (int)SqlHelper.ExecuteScalar(WebConn.connString, CommandType.Text, sql);
            return i;
        }
        /// <summary>
        /// 修改Report_TB_Grade
        /// 创建人：  Wilson 
        /// 创建时间：2013-1-30
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int SelectCountById()
        {
            int i = 0;
            string sql = "select count(GuId4) from Report_TB_Grade";
            i = (int)SqlHelper.ExecuteScalar(WebConn.connString, CommandType.Text, sql);
            return i;
        }
        #endregion
        #region##自定义Report_TB_Grade
        public DataSet GetReport(string tjnd, string schooltype, string districtid)
        {
            if (string.IsNullOrEmpty(schooltype))
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11  from Report_ZB_Grade a INNER JOIN  
                    HW_Grade b ON a.Grade = b.GradeCode where tjnd=@tjnd and a.Grade<>'34' and rid='01' group by a.Grade,b.gradename,a.xb order by Grade,xb";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11  from Report_ZB_Grade a INNER JOIN  
                    HW_Grade b ON a.Grade = b.GradeCode where tjnd=@tjnd and a.Grade<>'34' and rid='01' and (a.DISTRICTID=@districtid or a.cityid=@districtid)  group by a.Grade,b.gradename,a.xb order by Grade,xb";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid)
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11  from Report_ZB_Grade a INNER JOIN  
            HW_Grade b ON a.Grade = b.GradeCode where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='01' group by a.Grade,b.gradename,a.xb order by Grade,xb";
                    SqlParameter[] ps = new SqlParameter[]{
                new SqlParameter("@schooltype",schooltype),
                new SqlParameter("@tjnd",tjnd),
            };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11  from Report_ZB_Grade a INNER JOIN  
            HW_Grade b ON a.Grade = b.GradeCode where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='01' and (a.DISTRICTID=@districtid or a.cityid=@districtid)  group by a.Grade,b.gradename,a.xb order by Grade,xb";
                    SqlParameter[] ps = new SqlParameter[]{
                new SqlParameter("@schooltype",schooltype),
                new SqlParameter("@tjnd",tjnd),
                new SqlParameter("@districtid",districtid)
            };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
        }
        public DataSet GetReport2(string tjnd, string schooltype, string districtid)
        {
            if (string.IsNullOrEmpty(schooltype))
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(isnull(a.h4,0)+isnull(a.h5,0)+isnull(a.h6,0)) as h15,sum(isnull(a.h8,0)+isnull(a.h9,0)+isnull(a.h10,0)) as h16  from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where
                     tjnd=@tjnd and a.Grade<>'34' and rid='02'  group by a.Grade,b.gradename,a.xb order by a.Grade,xb    
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(isnull(a.h4,0)+isnull(a.h5,0)+isnull(a.h6,0)) as h15,sum(isnull(a.h8,0)+isnull(a.h9,0)+isnull(a.h10,0)) as h16  from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where
                     tjnd=@tjnd and a.Grade<>'34' and rid='02' and (a.DISTRICTID=@districtid or a.cityid=@districtid)  group by a.Grade,b.gradename,a.xb order by a.Grade,xb    
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid)
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(isnull(a.h4,0)+isnull(a.h5,0)+isnull(a.h6,0)) as h15,sum(isnull(a.h8,0)+isnull(a.h9,0)+isnull(a.h10,0)) as h16  from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where a.schooltype
                    =@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='02'  group by a.Grade,b.gradename,a.xb order by a.Grade,xb    
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                new SqlParameter("@schooltype",schooltype),
                new SqlParameter("@tjnd",tjnd),
                };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(isnull(a.h4,0)+isnull(a.h5,0)+isnull(a.h6,0)) as h15,sum(isnull(a.h8,0)+isnull(a.h9,0)+isnull(a.h10,0)) as h16  from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where a.schooltype
                    =@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='02' and (a.DISTRICTID=@districtid or a.cityid=@districtid)  group by a.Grade,b.gradename,a.xb order by a.Grade,xb    
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                new SqlParameter("@schooltype",schooltype),
                new SqlParameter("@tjnd",tjnd),
                new SqlParameter("@districtid",districtid)
            };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
        }
        public DataSet GetReport3(string tjnd, string schooltype, string districtid)
        {
            if (string.IsNullOrEmpty(schooltype))
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10 from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where 
                    tjnd=@tjnd and a.Grade<>'34' and rid='03' group by a.Grade,b.gradename,a.xb order by Grade,xb  
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10 from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where
                     tjnd=@tjnd and a.Grade<>'34' and rid='03' and (a.DISTRICTID=@districtid or a.cityid=@districtid) group by a.Grade,b.gradename,a.xb order by Grade,xb  
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10 from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where schooltype 
                    =@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='03' group by a.Grade,b.gradename,a.xb order by Grade,xb  
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10 from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where schooltype 
                    =@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='03' and (a.DISTRICTID=@districtid or a.cityid=@districtid) group by a.Grade,b.gradename,a.xb order by Grade,xb  
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }

        }
        public DataSet GetReport4(string tjnd, string schooltype, string districtid)
        {
            if (string.IsNullOrEmpty(schooltype))
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10 from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where 
                     tjnd=@tjnd and a.Grade<>'34' and rid='04' group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10 from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where 
                    tjnd=@tjnd and a.Grade<>'34' and rid='04' and (a.DISTRICTID=@districtid or a.cityid=@districtid) group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10 from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where 
                    schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='04' group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                new SqlParameter("@schooltype",schooltype),
                new SqlParameter("@tjnd",tjnd),
            };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.sj) as sj,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10 from Report_ZB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where 
                    schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='04' and (a.DISTRICTID=@districtid or a.cityid=@districtid) group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                new SqlParameter("@schooltype",schooltype),
                new SqlParameter("@tjnd",tjnd),
                new SqlParameter("@districtid",districtid),
            };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
        }
        public DataSet GetReportSg(string tjnd, string schooltype, string districtid)
        {
            if (string.IsNullOrEmpty(schooltype))
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(h15b) as h15b,sum(h16b) as h16b from 
                    Report_TB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where tjnd=@tjnd and a.Grade<>'34' and rid='01'  
                    group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(h15b) as h15b,sum(h16b) as h16b from 
                    Report_TB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where tjnd=@tjnd and a.Grade<>'34' and rid='01' and (a.DISTRICTID=@districtid or a.cityid=@districtid)
                    group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                new SqlParameter("@tjnd",tjnd),
                new SqlParameter("@districtid",districtid),
                };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(h15b) as h15b,sum(h16b) as h16b from 
                    Report_TB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='01'  
                    group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(h15b) as h15b,sum(h16b) as h16b from 
                    Report_TB_Grade a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='01' and (a.DISTRICTID=@districtid or a.cityid=@districtid)
                    group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                new SqlParameter("@schooltype",schooltype),
                new SqlParameter("@tjnd",tjnd),
                new SqlParameter("@districtid",districtid),
                };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
        }
        public DataSet GetReportTz(string tjnd, string schooltype, string districtid)
        {
            if (string.IsNullOrEmpty(schooltype))
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(a.h12) as h12,sum(a.h17b) as h17b,sum(a.h18b) as h18b
                    from Report_TB_GRADE a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode
                    where tjnd=@tjnd and a.Grade<>'34' and rid='01'  group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(a.h12) as h12,sum(a.h17b) as h17b,sum(a.h18b) as h18b from Report_TB_GRADE a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode
                    where tjnd=@tjnd and a.Grade<>'34' and rid='01' and (a.DISTRICTID=@districtid or a.cityid=@districtid) group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(a.h12) as h12,sum(a.h17b) as h17b,sum(a.h18b) as h18b
                    from Report_TB_GRADE a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode
                    where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='01'  group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                    SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(a.h12) as h12,sum(a.h17b) as h17b,sum(a.h18b) as h18b from Report_TB_GRADE a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode
                    where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='01' and (a.DISTRICTID=@districtid or a.cityid=@districtid) group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
        #endregion

        }
        public DataSet GetReportXw(string tjnd, string schooltype, string districtid)
        {
            if (string.IsNullOrEmpty(schooltype))
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(h15b) as h15b,sum(h16b) as h16b 
                    from Report_TB_GRADE a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where tjnd=@tjnd and a.Grade<>'34' and rid='02' group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(h15b) as h15b,sum(h16b) as h16b 
                    from Report_TB_GRADE a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where tjnd=@tjnd and a.Grade<>'34' and rid='02' and (a.DISTRICTID=@districtid or a.cityid=@districtid)
                    group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(h15b) as h15b,sum(h16b) as h16b 
                    from Report_TB_GRADE a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='02' group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h1) as h1,sum(a.h2) as h2,sum(a.h3) as h3,sum(a.h4) as h4,sum(a.h5) as h5,sum(a.h6) as h6,sum(h15b) as h15b,sum(h16b) as h16b 
                    from Report_TB_GRADE a INNER JOIN  HW_Grade b ON a.Grade = b.GradeCode where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='02' and (a.DISTRICTID=@districtid or a.cityid=@districtid)
                    group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
        }
        public DataSet GetReportFhl(string tjnd, string schooltype, string districtid)
        {
            if (string.IsNullOrEmpty(schooltype))
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(a.h12) as h12,sum(h14) as h14,sum(h15) as h15,sum(a.h17b) as h17b,sum(a.h18b) as h18b from 
                   Report_TB_GRADE a INNER JOIN HW_Grade b ON a.Grade = b.GradeCode where tjnd=@tjnd and a.Grade<>'34' and rid='02'  group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(a.h12) as h12,sum(h14) as h14,sum(h15) as h15,sum(a.h17b) as h17b,sum(a.h18b) as h18b from 
                   Report_TB_GRADE a INNER JOIN HW_Grade b ON a.Grade = b.GradeCode where tjnd=@tjnd and a.Grade<>'34' and rid='02' and (a.DISTRICTID=@districtid or a.cityid=@districtid) group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(districtid))
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(a.h12) as h12,sum(h14) as h14,sum(h15) as h15,sum(a.h17b) as h17b,sum(a.h18b) as h18b from 
                   Report_TB_GRADE a INNER JOIN HW_Grade b ON a.Grade = b.GradeCode where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='02'  group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
                else
                {
                    string sql = @"
                   SELECT b.gradename as Tjnd,a.Grade GradeBH,a.xb,sum(a.h7) as h7,sum(a.h8) as h8,sum(a.h9) as h9,sum(a.h10) as h10,sum(a.h11) as h11,sum(a.h12) as h12,sum(h14) as h14,sum(h15) as h15,sum(a.h17b) as h17b,sum(a.h18b) as h18b from 
                   Report_TB_GRADE a INNER JOIN HW_Grade b ON a.Grade = b.GradeCode where schooltype=@schooltype and tjnd=@tjnd and a.Grade<>'34' and rid='02' and (a.DISTRICTID=@districtid or a.cityid=@districtid) group by a.Grade,b.gradename,a.xb order by Grade,xb
                    ";
                    SqlParameter[] ps = new SqlParameter[]{
                    new SqlParameter("@schooltype",schooltype),
                    new SqlParameter("@tjnd",tjnd),
                    new SqlParameter("@districtid",districtid),
                    };
                    DataSet ds = SqlHelper.ExecuteDataset(WebConn.connString, CommandType.Text, sql, ps);
                    return ds;
                }
            }
        }
    }
}
